
var vm = new Vue({
  el: '#window',
  data() {
    return {
      // 进程
      process: [
        {icon: '', name: 'Windows 资源管理器', pid: '17604', state: '', cpu: '0.2%', ram: '34.8 MB', disk: '0MB/s', internet: '3.2 Mbps', gpu: '4.6%'},
        {icon: 'img/icon/512x512.png', name: '概念版任务管理器 (32位)', pid: '13775', state: '', cpu: '3%', ram: '76 MB', disk: '0.1MB/s', internet: '0 Mbps', gpu: '0.2%'},
        {icon: 'img/icon/edge.png', name: 'Microsoft Edge (9)', pid: '7827', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: 'img/icon/edge.png', name: 'Microsoft Edge (9)', pid: '12404', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'DAX API', pid: '12004', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'CTF 加载程序', pid: '12004', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'FileZilla Server (32位)', pid: '1247', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'Google Crash Handler (32位)', pid: '2720', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'Intel(R) Dynamic Tuning Service', pid: '12004', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'Intel(R) Dynamic Application Loader Host Inteface', pid: '2782', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'Application Loader Host Inteface', pid: '12004', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'Microsoft Store (2)', pid: '2720', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'Microsoft Edge (9)', pid: '12004', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'Microsoft Edge (9)', pid: '2782', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'Microsoft Edge (9)', pid: '12004', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'Microsoft Edge (9)', pid: '12004', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'Microsoft Edge (9)', pid: '2782', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},
        {icon: '', name: 'Microsoft Edge (9)', pid: '12004', state: '', cpu: '0%', ram: '465 MB', disk: '0MB/s', internet: '0 Mbps', gpu: '0%'},

      ],

      // 服务
      service: [
        {name: 'ArSvc', pid:'7854', describe: 'Agent Activation Runtime', group: 'AarSvcGroup', state: false},
        {name: 'ArSvc', pid:'81641', describe: 'Agent Activation Runtime', group: 'AarSvcGroup', state: true},
        {name: 'AarSvc_a6a97', pid:'4650', describe: 'AarSvc_a6a97', group: '', state: false},
        {name: 'AJRouter', pid:'87711', describe: 'AarSvc_a6a97', group: '', state: false},
        {name: 'Appinfo', pid:'87741', describe: 'Application Layer Gateway Service', group: '', state: false},
      ],
      
      // 应用历史记录
      record: [
        {icon: '', name: 'Windows 资源管理器', cputime: '0:00:32', internet: '0 MB', flow: '0 MB', notice:'0 MB'},
        {icon: 'img/icon/edge.png', name: 'Microsoft Edge (9)', cputime: '0:00:47', internet: '16.4 GB', flow: '0 MB', notice:'0 MB'},
      ],

      // 启动
      start: [
        {icon: '', name: 'Windows 资源管理器', issuer: 'Administrators', effect: '无', state: true},
        {icon: 'img/icon/edge.png', name: 'Microsoft Edge (9)', issuer: 'Administrators', effect: '无', state: false},
      ],


      // 详细信息
      explicit: [
        {icon: '', name: 'Windows 资源管理器', pid: '', state: '正在运行', user: "SYSTEM", ram:"1206K", structure:"X64", describe:"Windows资源管理器"},
        {icon: 'img/icon/edge.png', name: 'Microsoft Edge (9)', pid: '', state: '正在运行', user: "SYSTEM", ram:"2500K", structure:"X86", describe:""},
      ]
    }
  },
  
  methods: {
    TableCellStyle({ row, column, rowIndex, columnIndex }){
      if (columnInex === 3) {
        return 'background-color:"#ccc"';
      }

    },menu_click(command) {
      var tab = $(".el-tabs__nav").attr("data-tab");

      if(command == "a"){
        if(tab == 2){
          win_service_refresh()
        }

      }
      
      if(command == "e"){
        if(getUrl("mode") == 1){
          window.location.href = "#?mode=0";
          win_save("config","ui-mode","0");
        } else {
          window.location.href = "#?mode=1";
          win_save("config","ui-mode","1");
        }
      }

    },nav_click(tab,e){
      $(".el-tabs__nav").attr("data-tab",tab.name)
    }

  }

});

$(function(){
  $('.process .el-table__header th .cell').each(function () {
    var name = $(this).text();
    if (name == 'CPU') {
      $(this).prepend('<b class="bold data_cpu">4%</b><br>')
    } else if (name == '内存') {
      $(this).prepend('<b class="bold data_ram">37%</b><br>')
    } else if (name == '磁盘') {
      $(this).prepend('<b class="bold data_disk">24%</b><br>')
    } else if (name == '网络') {
      $(this).prepend('<b class="bold data_network">6%</b><br>')
    } else if (name == 'GPU') {
      $(this).prepend('<b class="bold data_gpu">12%</b><br>')
    } else {
      $(this).prepend('<br>')
    }
  });

  var mode = getUrl("mode");
  if(mode == "1"){
    $("#ui-mode").text("明亮模式");
  } else{
    $("#ui-mode").text("暗色模式");
  }



  $("#v_nav > .v_item").click(function(){
    $("#v_nav > .v_item").removeClass("v_sel");
    $(this).addClass("v_sel");
    $("#v_nav").attr("page",$(this).attr("name"))
  })

})



